package net.bblot.lottery.webInterface;


import net.bblot.lottery.activity.BaseDroidGapActivity;

public class WebInvoke {
    private final static String TAG = "WebInvoke";
    private BaseDroidGapActivity ba;

    public WebInvoke(BaseDroidGapActivity ba) {
        this.ba = ba;
    }

    public void loadUrl(String url) {
        ba.loadUrl("javascript:handleOpenURL('" + url + "');");
    }

    public void shareSucess(String pageId) {
        // ba.loadUrl("javascript:loginObj('share','scorePrize')");
        ba.loadUrl("javascript:shareSucAddScore('" + pageId + "')");
    }

    public void noticeWifiStatusChange(int wifiEnabled, String ssid) {
        // Toast.makeText(ba, "wifi状态改变", Toast.LENGTH_SHORT).show();
        try {
            ba.loadUrl("javascript:getWifiStatusCallBack('" + wifiEnabled + "','" + ssid + "')");
        } catch (Exception e) {
            // TODO: handle exception
        }
    }

    public void getPushClientIdCallBack(String clientId) {
//         Toast.makeText(ba, "clientId=" + clientId, Toast.LENGTH_LONG).show();
        //
        try {
            ba.loadUrl("javascript:getPushClientIdCallBack('" + clientId + "')");
        } catch (Exception e) {
            // TODO: handle exception
        }

    }

    public void getCamraImageCallback(String base64, String num, String type) {
//		Toast.makeText(ba, num, Toast.LENGTH_LONG).show();
        ba.loadUrl("javascript:getCamraImageCallback('" + base64 + "','" + num + "','" + type + "')");
    }

    public void getPayWeixinCallback(String errcode) {
//		Toast.makeText(ba, num, Toast.LENGTH_LONG).show();
        ba.loadUrl("javascript:getPayWeixinCallback('" + errcode + "')");
    }

    public void getScanQRCodeCallback(String type,String value) {
//		Toast.makeText(ba, num, Toast.LENGTH_LONG).show();
        ba.loadUrl("javascript:getScanQRCodeCallback('" + type + "','" + value + "')");
    }

    public void socialAuthCallBack(String type, String platform, String uid, String name, String iconurl) {
//        Toast.makeText(ba, platform + "  " + data, Toast.LENGTH_LONG).show();
        ba.loadUrl("javascript:socialAuthCallBack('" + type + "','" + platform + "','" + uid + "','" + name + "','" + iconurl + "')");
    }
}
